mod editor;
mod keyboard;
mod screen;

use editor::*;

fn main() -> crossterm::Result<()> {
  let mut args = std::env::args();

  // cargo run input.txt
  let mut editor = if args.len() >= 2 {
    Editor::with_file(args.nth(1).unwrap())?
  } else {
    // cargo run
    Editor::new()?
  };

  editor.start()?;

  Ok(())
}
